package com.zui.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.struts2.json.annotations.JSON;

import com.sun.istack.internal.NotNull;

@MappedSuperclass
public class BaseEntity implements Serializable {
	//TODO: 一定要进行源代码管理;
	//TODO: 有效管理需求列表,列出优先级,JIRA;
	//TODO: 到底ID还是Id? String or Long, Generated or assigned?
	//TODO: 代码重构，entity, web分开
	//TODO: pinyin for geo in china.
	//TODO: iobike方向，做接口，做平台，贡献技术？
	//TODO: 搞定58同城的城市数据
	//TODO: doubleselect, ajax? utility methods?
	//TODO: name, nameEn, 数据库多语言？

	private static final long serialVersionUID = 1L;

	public final static String FLAG_Y = "Y";
	public final static String FLAG_N = "N";
	public final static String BASE_CATALOG_Id = "IOBIKE";
	
	protected String description;
	protected String isDeleted = FLAG_N;
	protected Date createdDate;
	protected String createdByUserLogin;
	protected Date lastModifiedDate;
	protected String lastModifiedByUserLogin;

	/**------------------------------
	 * getters and annotations
	 --------------------------------*/
	
	@Column(length=256)
	@JSON(serialize = false)
	public String getDescription() {return description;}
	
	@Column(length=1) @NotNull
	public String getIsDeleted() {return isDeleted;}

	@Column(insertable=true,updatable=false)
	@Temporal(TemporalType.TIMESTAMP)
	@JSON(serialize = false)
	public Date getCreatedDate() {return createdDate;}

	@Column(length=20,insertable=true,updatable=false)
	@JSON(serialize = false)
	public String getCreatedByUserLogin() {return createdByUserLogin;}

	@Temporal(TemporalType.TIMESTAMP)
	@JSON(serialize = false)
	public Date getLastModifiedDate() {return lastModifiedDate;}

	@JSON(serialize = false)
	public String getLastModifiedByUserLogin() {return lastModifiedByUserLogin;	}

	/**------------------------------
	 * setters
	 --------------------------------*/
	
	public void setDescription(String description) {
		this.description = description;
	}
	public void setIsDeleted(String isDeleted) {
		this.isDeleted = isDeleted;
	}
	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}
	public void setCreatedByUserLogin(String createdByUserLogin) {
		this.createdByUserLogin = createdByUserLogin;
	}
	public void setLastModifiedDate(Date lastModifiedDate) {
		this.lastModifiedDate = lastModifiedDate;
	}
	public void setLastModifiedByUserLogin(String lastModifiedByUserLogin) {
		this.lastModifiedByUserLogin = lastModifiedByUserLogin;
	}
	
}
